package com.manage.platform.controller;

import com.manage.platform.dto.TaskDto;
import com.manage.platform.dto.TaskUpdateDto;
import com.manage.platform.dto.query.TaskPageQuery;
import com.manage.platform.service.impl.IndicatorSystemImpl;
import com.manage.platform.service.impl.OrganizeServiceImpl;
import com.manage.platform.service.impl.TaskServiceImpl;
import com.manage.platform.service.impl.UserServiceImpl;
import com.manage.platform.utils.R;
import com.manage.platform.utils.RPage;
import com.manage.platform.vo.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lk
 */
@AllArgsConstructor
@RestController
@RequestMapping("/task")
@Tag(name = "任务管理")
public class TaskController {

    private final TaskServiceImpl taskServiceImpl;
    private final UserServiceImpl userServiceImpl;
    private final IndicatorSystemImpl indicatorSystemImpl;
    private final OrganizeServiceImpl organizeServiceImpl;


    @PostMapping("/getTaskPage")
    @Operation(summary = "1.任务列表(分页)")
    public R<RPage<List<TaskPartVo>>> getTaskPage(@RequestBody TaskPageQuery query) {
        return R.ok(taskServiceImpl.getTaskPage(query));
    }

//    @GetMapping("/getTaskDetails")
//    @Operation(summary = "2.查询任务详情")
//    public R<TaskDetailsVo> getTaskDetails(@Schema(description = "任务ID") @RequestParam("id") Long id) {
//        return R.ok(taskServiceImpl.getTaskDetails(id));
//    }


//    @PostMapping("/saveTask")
//    @Operation(summary = "3.添加任务")
//    public R<Boolean> saveTask(@RequestBody TaskDto dto) {
//        return R.ok(taskServiceImpl.saveTask(dto));
//    }
//
//    @PutMapping("/updateTask")
//    @Operation(summary = "4.修改任务")
//    public R<Boolean> updateTask(@RequestBody TaskUpdateDto dto) {
//        return R.ok(taskServiceImpl.updateTask(dto));
//    }
//
//    @DeleteMapping("/deleteTask/{id}")
//    @Operation(summary = "5.删除任务")
//    public R<Boolean> deleteTask(@Schema(description = "任务ID") @PathVariable Long id) {
//        return R.ok(taskServiceImpl.deleteTask(id));
//    }
//
//    @DeleteMapping("/deleteTaskBatch")
//    @Operation(summary = "6.批量删除任务")
//    public R<Boolean> deleteTaskBatch(@Schema(description = "任务ID集合") @RequestBody List<Long> ids) {
//        return R.ok(taskServiceImpl.deleteTaskBatch(ids));
//    }
//

    //筛选项========================================================================================================
    //============================================================================================================
    @GetMapping("/getTaskList")
    @Operation(summary = "任务列表(筛选项)")
    public R<List<CommonVo>> getTaskList(@Schema(description = "任务名称")
                                         @RequestParam(value = "name", required = false) String name) {
        return R.ok(taskServiceImpl.getTaskList(name));
    }


    @GetMapping("/getCollegeList")
    @Operation(summary = "学院(部门)列表(筛选项)")
    public R<List<CommonVo>> getCollegeList(@Schema(description = "学院名称")
                                            @RequestParam(value = "name", required = false) String name) {
        return R.ok(organizeServiceImpl.getCollegeList(name));
    }

//    //负责人筛选项
//    @GetMapping("/getUserList")
//    @Operation(summary = "负责人(参与者)(筛选项)")
//    public R<List<OrganizeMemberPartVo>> getUserList(@Schema(description = "人员姓名")
//                                                     @RequestParam(value = "realName", required = false) String realName) {
//        return R.ok(userServiceImpl.getUserList(realName));
//    }
//    //指标体系筛选项
//    @GetMapping("/getIndicatorList")
//    @Operation(summary = "指标体系列表(筛选项)")
//    public R<List<CommonVo>> getIndicatorList(@Schema(description = "指标体系名称")
//                                              @RequestParam(value = "name", required = false) String name) {
//        return R.ok(indicatorSystemImpl.getIndicatorList(name));
//    }


}
